home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 July / EnigmA AMIGA RUN 20 (1997)(G.R. Edizioni)(IT)[!][issue 1997-07 & 08][EAR-CD IV].iso / lightwave / arexx_macros / rotscl / rotate_on_center.lwm next >
Text File  |  1994-08-08  |  1KB  |  57 lines

  1. /* CMD: Rotate_On_Center
  2.  * Rotate Object by it's center */
  3. /* Nir Hermoni, zapa@datasrv.co.il
  4. */
  5.  
  6. libadd = addlib("LWModelerARexx.port",0)
  7. signal on error
  8. signal on syntax
  9.  
  10. box=boundingbox()  /* Should check out empty list ...  */
  11. parse var box n x1 x2 y1 y2 z1 z2
  12. say box
  13. cx=(x2+x1)/2
  14. cy=(y2+y1)/2
  15. cz=(z2+z1)/2
  16.  
  17. call req_begin "Rotate on object center"
  18.  
  19. rotateID = req_addcontrol(" rotation","N",0)
  20. AxID = req_addcontrol(" Axis","CH",'X Y Z')
  21.  
  22. call req_setval rotateID,0
  23. call req_setval AxID,1
  24.  
  25. if (~req_post()) then do
  26.     call req_end
  27.     exit
  28. end
  29.  
  30. rotation = req_getval(rotateID)
  31. rotaxis = req_getval(AxID)
  32.  
  33. if rotaxis = 1 then rotaxis = 'X'
  34. if rotaxis = 2 then rotaxis = 'Y'
  35. if rotaxis = 3 then rotaxis = 'Z'
  36.  
  37. call req_end()
  38.  
  39. /* Uncomment this to ask if really perform
  40. line1 = ' Angle = 'rotation
  41. line2 = ' Axis = 'rotaxis
  42. ask_ok = "@Perform rotation? (undo to undo)"
  43.  
  44. ok=NOTIFY(3,line1,line2,' ',ask_ok)
  45. if ok = 0 then exit
  46. *******************************************/
  47. call ROTATE(rotation,rotaxis,cx cy cz)
  48.  
  49. if (libadd) then call remlib("LWModelerARexx.port")
  50. exit
  51.  
  52. syntax:
  53. error:
  54.     t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
  55.   if (libadd) then call remlib("LWModelerARexx.port")
  56.     exit
  57.